


local mt = ac.skill['潮汐使者']
mt.castetArt = [[effects\WaterHands.mdx]]
mt.TargetArt = [[Abilities\Weapons\WaterElementalMissile\WaterElementalMissile.mdl]]

function mt:on_cooldown()
    local hero = self.owner
    self:gc_clear()
    self:gc(hero:add('攻击加成',self.data1))
    self:gc(hero:add('分裂攻击',100))
    self:gc(hero:add_effect(self.castetArt,'hand right'))
    self:gc(hero:add_effect(self.castetArt,'weapon'))
    self:gc(hero:event '单位-造成分裂伤害'(function(_,_,target)
        target:add_effect(self.TargetArt):remove()
    end))
    self:gc(hero:event '单位-造成伤害结束'(function(_,_,target,data)
        if data:is_attack() then
            self:gc_clear()
            self:cooling()
        end
    end))
end

local mt = ac.skill['幽灵船']
mt.targettype = '点'
mt.range = 1500
mt.distance = 2500
mt.target_art = [[dcebf9ab46c979af453c0cddcae6fe03.mdx]]
mt.missile_art = [[3ff64367a48e188b0acc4d36f64f0c53.mdx]]
mt.missile_speed = 1200

function mt:on_cast_shot()
    local hero = self.owner
    local target = self.target
    local angle = hero:get_point()/target:get_point()
    self:shot_missile(angle)
end

function mt:shot_missile(angle)
    local hero = self.owner
    local start = hero:get_point() - {angle,-900}
    local group = {}
    local damage = hero:get('攻击') * self.data1/100
    ac.mover('line'){
        start = start,
        angle = angle,
        size = 1,
        model = self.missile_art,
        speed = self.missile_speed,
        distance = self.distance,
        on_move = function(_,point)
            for u in ac.selector('unit')
                : range(point,150)
                : enemy(hero)
                : loop()
            do
                if not group[u] then
                    group[u] = true
                    u:add_buff '晕眩'{time = 1}
                    u:damage{
                        damage_type = self.damage_type,
                        source = hero,
                        damage = damage,
                        skill = self,
                    }
                    
                end
            end

        end,
        on_finish = function(mover)
            local point = mover:get_point()
            point:add_effect(self.target_art):remove()
            self:notify('on_finish',mover)
        end
    }
end



local mt = ac.skill['船长的橘子']
mt.model1 = [[d79b6e36b5388413f69854db3a90e320.mdx]]
function mt:on_add()
    local hero = self.owner
    self:gc(hero:add('力量成长',self.data3))
end

function mt:on_cooldown()
    local hero = self.owner
    local heal = hero:get('力量') * self.data1/100 + self.data2
    self:cooling()
    hero:add_effect(self.model1):remove()
    hero:add('生命',heal)
end

